﻿<%@ Page Language="C#" MasterPageFile="~/admin/adminMasterPage.master" AutoEventWireup="true"
    CodeFile="Menus.aspx.cs" Inherits="admin_Menus" Title="Untitled Page" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<title>Menus</title>
    <link rel="stylesheet" type="text/css" media="screen,projection,print" href="css/layout2_setup.css" />
    <link rel="stylesheet" type="text/css" media="screen,projection,print" href="css/layout2_text.css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">
    <h1>
        Quản lý danh sách menu:
    </h1>
    <div style="float:left; width:450px;" id="div1">
            <telerik:RadTextBox ID="txtMainMenu" runat="server" Width="300px" Label="Tên: " 
                            CssClass="field" LabelCssClass="left" SelectionOnFocus="SelectAll" ValidationGroup="addmain">
            </telerik:RadTextBox>
            <telerik:RadComboBox ID="cbbPositions" runat="server"  Label="Vị trí:" LabelCssClass="left" Width="300px" ValidationGroup="addmain">
            </telerik:RadComboBox>
            <telerik:RadButton ID="btnAddMain" runat="server" Text="- Add -" CssClass="button" ValidationGroup="addmain" OnClick="btnAddMain_OnClick">
            </telerik:RadButton>
    </div>
    <div style="float:right; width:450px;" id="div2">
            <telerik:RadTextBox ID="txtSubMenu" runat="server" Width="300px" Label="Tên:" 
                            CssClass="field" LabelCssClass="left" SelectionOnFocus="SelectAll" ValidationGroup="addsub">
            </telerik:RadTextBox>
            <telerik:RadComboBox ID="cbbParent" runat="server"  Label="Menu Cha:" LabelCssClass="left" Width="300px"  ValidationGroup="addsub"
                            OnSelectedIndexChanged="cbbParent_OnSelectedIndexChanged">
            </telerik:RadComboBox>
            <telerik:RadButton ID="btnAddSub" runat="server" Text="- Add -" CssClass="button"  ValidationGroup="addsub" OnClick="btnAddSub_OnClick">
            </telerik:RadButton>
    </div>
    <br />
         <hr class="clear-contentunit" />
         
          <div style="float:left; width:450px;">
          
          <telerik:RadGrid AutoGenerateColumns="False" ID="grvMainPanel" AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True"
                        runat="server" Width="450px" OnSelectedIndexChanged="grvMainPanel_OnSelectedIndexChanged" OnDeleteCommand="grvMainPanel_OnDeleteCommand"  
                        ClientSettings-AllowRowsDragDrop="true" OnRowDrop="grvMainPanel_OnRowDrop">
                <PagerStyle Mode="NextPrevAndNumeric"/>
                <ClientSettings EnableRowHoverStyle="true">
                    <Selecting AllowRowSelect="true" EnableDragToSelectRows="false"/>
                    <Scrolling AllowScroll="true" UseStaticHeaders="true"/>
                </ClientSettings>
                <GroupingSettings CaseSensitive="false"  />
                <MasterTableView TableLayout="Fixed" runat="server" AllowPaging="true" PageSize="10" DataKeyNames="panelID">
                    <Columns>
                        <telerik:GridDragDropColumn HeaderStyle-Width="18px" Visible="false" />
                    <telerik:GridBoundColumn HeaderText=" Tên" DataField="name" UniqueName="name"
                            SortExpression="name" HeaderStyle-Width="120px" FilterControlWidth="110px"
                            AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" />
                    <telerik:GridBoundColumn HeaderText="Vị trí" DataField="positionName" UniqueName="positionName"
                            SortExpression="positionName" HeaderStyle-Width="80px" FilterControlWidth="110px"
                            AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" />
                    <telerik:GridCheckBoxColumn DataField="isActived" UniqueName="isActived" HeaderText="Kích hoạt"
                            HeaderStyle-Width="40px" />
                    <telerik:GridButtonColumn ConfirmText="Xóa menu chính này?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" UniqueName="DeleteColumn">
                        <ItemStyle HorizontalAlign="Center"/>
                    </telerik:GridButtonColumn>
                            <telerik:GridButtonColumn Text="Xem menu con" CommandName="Select" HeaderStyle-Width="100px">
                        </telerik:GridButtonColumn>
                    </Columns>
                    </MasterTableView>
            </telerik:RadGrid>
            
          </div>
          
          <asp:HiddenField ID="hiddenID" runat="server" />
          <div style="float:right; width:450px;">
          <telerik:RadGrid AutoGenerateColumns="False" ID="grvSubPanel" AllowFilteringByColumn="True" 
                                        AllowPaging="True" AllowSorting="True" runat="server" Width="450px" OnDeleteCommand="grvSubPanel_OnDeleteCommand"
                                        ClientSettings-AllowRowsDragDrop="true" OnRowDrop="grvSubPanel_OnRowDrop">
            <PagerStyle Mode="NextPrevAndNumeric"/>
            <ClientSettings EnableRowHoverStyle="true">
                    <Selecting AllowRowSelect="true" EnableDragToSelectRows="false"/>
                    <Scrolling AllowScroll="true" UseStaticHeaders="true"/>
                </ClientSettings>
                <GroupingSettings CaseSensitive="false" />
                <MasterTableView TableLayout="Fixed" runat="server" AllowPaging="true" PageSize="10" DataKeyNames="panelID">
                    <Columns>
                            <telerik:GridDragDropColumn HeaderStyle-Width="18px" Visible="false" />
                            <telerik:GridBoundColumn HeaderText=" Tên" DataField="name" UniqueName="name"
                            SortExpression="name" HeaderStyle-Width="120px" FilterControlWidth="110px"
                            AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" />
                    <telerik:GridBoundColumn HeaderText="Vị trí" DataField="parentsName" UniqueName="parentsName"
                            SortExpression="parentsName" HeaderStyle-Width="120px" FilterControlWidth="110px"
                            AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" />
                    <telerik:GridCheckBoxColumn DataField="isActived" UniqueName="isActived" HeaderText="Kích hoạt"
                            HeaderStyle-Width="40px" />
                             <telerik:GridButtonColumn ConfirmText="Xóa Menu con này?" ConfirmDialogType="RadWindow"
                        ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" UniqueName="DeleteColumn">
                        <ItemStyle HorizontalAlign="Center"/>
                    </telerik:GridButtonColumn>
                    </Columns>
                    </MasterTableView>
            </telerik:RadGrid>
          </div>
          
            <!----------------------------------------------- sử dụng ajax-------------------------------------------->
        <!-- validate -->
    <telerik:RadInputManager ID="RadInputManager1" runat="server">
            <telerik:TextBoxSetting BehaviorID="TextBoxBehavior1" Validation-IsRequired="true">
                <TargetControls>
                    <telerik:TargetInput ControlID="div1" />
                </TargetControls>
            </telerik:TextBoxSetting>
            <telerik:TextBoxSetting BehaviorID="TextBoxBehavior2" Validation-IsRequired="true">
                <TargetControls>
                    <telerik:TargetInput ControlID="div2" />
                </TargetControls>
            </telerik:TextBoxSetting>
    </telerik:RadInputManager>
    
    <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanelAdmin" />
    
        <!-- rad ajax manager -->
         <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="grvMainPanel">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="grvMainPanel" LoadingPanelID="RadAjaxLoadingPanelAdmin" />
                    <telerik:AjaxUpdatedControl ControlID="grvSubPanel" LoadingPanelID="RadAjaxLoadingPanelAdmin" />
                    <telerik:AjaxUpdatedControl ControlID="cbbParent" LoadingPanelID="RadAjaxLoadingPanelAdmin" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="grvSubPanel">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="grvSubPanel" LoadingPanelID="RadAjaxLoadingPanelAdmin" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cbbParent">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="grvSubPanel" LoadingPanelID="RadAjaxLoadingPanelAdmin" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        </telerik:RadAjaxManager>
        
<!----------------------------------------hết đoạn sử dụng ajax-------------------------------------->
</asp:Content>
